package vip.george.security.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
/**
 * 过滤器配置
 *
 * @author wang
 * @since 2022-05-20
 **/
@Configuration
public class EncryptFilterConfig {

    @Bean
    public InterfaceEncryptFilter interfaceEncryptFilter(){
        return new InterfaceEncryptFilter();
    }

    /**
     * 注册过滤器
     */
    @Bean
    public FilterRegistrationBean someFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(interfaceEncryptFilter());
        registration.addUrlPatterns("/*");
        registration.setName("interface-encrypt-filter");
        registration.setOrder(1);
        return registration;
    }

}
